package com.qf.controller;

import com.qf.service.FangDong;
import com.qf.service.FangKe;
import com.qf.service.UserService;
import com.qf.service.impl.FangDongImpl;
import com.qf.service.impl.UserServiceImpl;
import com.qf.utils.MyProxyFactory;
import com.qf.utils.MyProxyFactoryBetter;
import com.qf.utils.TimeInvocationHandler;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 动态代理工厂测试
 */
public class RentHouseContreller2 {
    public static void main(String[] args) {

//        FangDongImpl fangDong = new FangDongImpl();
//        FangDong proxy = (FangDong) MyProxyFactory.getProxy(fangDong);
//        proxy.rentHouse();

//        UserServiceImpl userService = new UserServiceImpl();
//        UserService proxy1 = (UserService) MyProxyFactory.getProxy(userService);
//        proxy1.login();

        FangDongImpl fangDong = new FangDongImpl();

        TimeInvocationHandler handler = new TimeInvocationHandler(fangDong);
        FangDong proxy = (FangDong) MyProxyFactoryBetter.getProxy(fangDong,handler);
        proxy.rentHouse();
    }
}
